package com.sunni.controller;

import com.sunni.entity.Role;
import com.sunni.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;


@Component("roleController") //2.实例化controller层
@RequestMapping("/role")
public class RoleController {

    @Autowired
    @Qualifier("roleService") //1.注入roleService
    private RoleService roleService;

    @RequestMapping("/selectAll")
    @ResponseBody
    public void selectAll(){
        for (Role role : roleService.selectAll()) {
            System.out.println("role = " + role);
        }
    }

}
